home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / sgverinf / REPORTIE.VBS < prev    next >
Text File  |  1998-08-17  |  3KB  |  83 lines

  1. '--------------------------------------------------------------------------
  2. ' ReportIEVersion.vbs - Reports version of the Internet Explorer files
  3. '
  4. ' This file is part of the sgVersionInfo.
  5. ' Copyright (C) 1998 Stinga
  6. ' All rights reserved.
  7. '
  8. ' This source code demonstrates usage of the sgVersionInfo component.
  9. ' and it's numeric properties.
  10. '--------------------------------------------------------------------------
  11.  
  12. ' Create some objects
  13. set VerInfo = WScript.CreateObject("sgVersionInfo.VersionInfo")
  14. Set fs      = WScript.CreateObject("Scripting.FileSystemObject")
  15. Set wsh     = WScript.CreateObject("WScript.shell")
  16. Set ie      = WScript.CreateObject("InternetExplorer.Application")
  17.  
  18. On Error Resume Next
  19. Dim sMsg
  20. Dim vbCrLf
  21. vbCrLf = Chr(13) + Chr(10)
  22.  
  23. ' Are we running from command line?
  24. Dim bFromCmdLine
  25. bFromCmdLine = false
  26. if InStrRev(UCase(WScript.FullName), "CSCRIPT") then bFromCmdLine = true
  27.  
  28. ' Get system folder
  29. 'Dim sSystemFolder
  30. 'Set sSystemFolder = wsh.Environment("Process")("WINDIR")
  31.  
  32.  
  33. ' Collect info ...
  34. sMsg = GetInfo("EXPLORER.EXE")
  35. sMsg = sMsg + GetInfo("SHDOCVW.DLL")
  36. sMsg = sMsg + GetInfo("MSHTML.DLL")
  37. sMsg = sMsg + GetInfo("URLMON.DLL")
  38. sMsg = sMsg + GetInfo("URL.DLL")
  39.  
  40. ' ... and display it
  41. if bFromCmdLine then
  42.     WScript.Echo sMsg, "SG VersionInfo Example"
  43. else
  44.     MsgBox sMsg
  45. end if
  46.  
  47. set VerInfo = Nothing
  48. Set fs      = Nothing
  49. Set ie      = Nothing
  50. WScript.Quit(0)
  51.  
  52.  
  53. '--------------------------------------------------------------------------
  54. ' Collect info for specified file and return it in the string variable
  55. '--------------------------------------------------------------------------
  56. Private Function GetInfo(path)
  57.     On Error Resume Next
  58.     GetInfo = ""
  59.  
  60.     ' Try to get version info for current file
  61.     VerInfo.Path = path
  62.     if Err.Number = 0 then
  63.         ' No error. Collect version info if file contains any
  64.         if VerInfo.InfoExist then
  65.                 GetInfo = VerInfo.FileDescription + " (" + path + ")" + vbCrLf
  66.                 GetInfo = GetInfo + "File Version:" + Chr(9)
  67.                 GetInfo = GetInfo + CStr(VerInfo.FileVersionHigh \ 65536) + "."
  68.                 GetInfo = GetInfo + CStr(VerInfo.FileVersionHigh Mod 65536) + "."
  69.                 GetInfo = GetInfo + CStr(VerInfo.FileVersionLow \ 65536) + "."
  70.                 GetInfo = GetInfo + CStr(VerInfo.FileVersionLow Mod 65536) + vbCrLf
  71.                 GetInfo = GetInfo + "Product Version:" + Chr(9)
  72.                 GetInfo = GetInfo + CStr(VerInfo.ProductVersionHigh \ 65536) + "."
  73.                 GetInfo = GetInfo + CStr(VerInfo.ProductVersionHigh Mod 65536) + "."
  74.                 GetInfo = GetInfo + CStr(VerInfo.ProductVersionLow \ 65536) + "."
  75.                 GetInfo = GetInfo + CStr(VerInfo.ProductVersionLow Mod 65536) + vbCrLf + vbCrLf
  76.         end if
  77.     else
  78.         ' Somethig went wrong
  79.         GetInfo = file.Name + ": " + Err.Decription + vbCrLf
  80.         Err.Clear
  81.     end if
  82. End Function
  83.